package h0722;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
  * @description 全排列
  * @author 不知名帅哥
  * @date 2024/7/22 23:04
  * @version 1.0
*/
public class Permutation {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String s = sc.nextLine();

        Set<String> set=new HashSet<>();
        boolean[] used=new boolean[s.length()];
        StringBuilder current=new StringBuilder();
        backTrack(s,used,current,set);
        System.out.println(set.size());
    }

    private static void backTrack(String s, boolean[] used, StringBuilder current, Set<String> set) {
        if (current.length()==s.length()){
            set.add(current.toString());
            return;
        }
        for (int i = 0; i < s.length(); i++) {
            if (used[i]){ //字符已经被使用过。
                continue;
            }
            current.append(s.charAt(i));
            used[i]=true;
            //递归调用
            backTrack(s,used,current,set);
            //撤销选择
            used[i]=false;
            current.deleteCharAt(current.length()-1);
        }
    }
}
